package server.business.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Select;
import server.business.pojo.AboType;
import server.business.pojo.BloodTestStates;
import server.main.config.cache.MybatisPlusRedisCache;
import server.business.pojo.BloodSamplePatient;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
* @author Galaxy
* @description 针对表【blood_sample_patient】的数据库操作Mapper
* @createDate 2022-11-08 12:46:24
* @Entity server.business.pojo.BloodSamplePatient
*/
@Mapper
//@CacheNamespace(implementation = MybatisPlusRedisCache.class)
public interface BloodSamplePatientMapper extends BaseMapper<BloodSamplePatient> {
    /**
     * 根据blood_sample_number查询验血患者血样
     * @param bloodSampleNumber
     * @return
     */
    @Select("select * from blood_sample_patient where blood_sample_number=#{bloodSampleNumber} and purpose=1 and " +
            "is_invalid=0 and is_deleted=0")
    BloodSamplePatient selectByNumber(String bloodSampleNumber);

    /**
     * 根据blood_sample_number查询配血患者血样
     * @param bloodSampleNumber
     * @return
     */
    @Select("select * from blood_sample_patient where blood_sample_number=#{bloodSampleNumber} and purpose=0 and " +
            "is_invalid=0 and is_deleted=0")
    BloodSamplePatient selectDispenseByNumber(String bloodSampleNumber);

    /**
     * 根据patient_id查询配血患者血样
     * @param patientId
     * @return
     */
    @Select("select * from blood_sample_patient where patient_id=#{patientId} and purpose=0 and " +
            "is_invalid=0 and is_deleted=0")
    BloodSamplePatient selectDispenseByPatientId(Long patientId);

}




